{include file = 'f-header.tpl'}


<div class="main">
        <div class="search">
            <div class="search_left">
                    <div class="s_tab">
                        <a class="s_tab_1" href="#">{$lang.shopSearch}</a>
                        <a class="s_tab_2" href="#">{$lang.adsSearch}</a>
                    </div>
                    <div class="tab1">
                        <form name="form1" action="{$baseurl}info/ajaxSearch" method="post">
                            <input class="skw"id="keyword" name="keyword" placeholder="keyword..." value="" />
                            <select id="class" name="class">
                                <option value="all">{$lang.allClass}</option>
                                <option value="1">{$lang.class1}</option>
                                <option value="2">{$lang.class2}</option>
                                <option value="3">{$lang.class3}</option>
                                <option value="4">{$lang.class4}</option>
                            </select>
                            <select id="search" name="city">
                                <option value="all">{$lang.allCity}</option>
                                <option value="{$lang.city1}">{$lang.city1}</option>
                                <option value="{$lang.city2}">{$lang.city2}</option>
                                <option value="{$lang.city3}">{$lang.city3}</option>
                            </select>
                            <a id="searchk" href="#" class="searchbtn" ></a>
                        </form>
                    </div>
                    <div class="tab2">
                        <form  name="form2" action="{$baseUrl}ads/search" method="post">
                            <input class="skw" name="" placeholder="keyword..." />
                            <a href="#" class="searchbtn" onclick="form2.submit();"></a>
                        </form>
                    </div>
                </div>
			<div class="search_right" id="sr">
                    {foreach item="value" key="key" from=$icoRs} 
                        <div class="item">
                        <a href="#"><img src={$value.info_ico}  alt="{$value.info_name}" title="" /></a>
                        <div class="caption">
                        <p><a href="{$baseUrl}info/single?id={$value.info_id}" title={$value.info_name}>查看信息</a></p>
                        <p><a href="javascript:showWhere('{$value.info_google_address}',{$value.info_class},{$value.info_id},'{$value.info_name}')" title={$value.info_name}>查看地址</a></p>
                        </div>
                        </div>
                    {/foreach}
                </div>
			</div>

    <div class="map">
				<div class="map_main">
                    <div id="map_canvas" style=""></div>
				</div>
				<div class="map_info">
					<p>Centri Maps</p>
					<div class="map_info_s">
						<img src="{$baseUrl}public/images/icon1.png" />
						<span>Centri deluxe </span>
					</div>
					<div class="map_info_s">
						<img src="{$baseUrl}public/images/icon2.png" />
						<span>Centri deluxe </span>
					</div>
					<div class="map_info_s">
						<img src="{$baseUrl}public/images/icon3.png" />
						<span>Centri deluxe </span>
					</div>
					<div class="map_info_s">
						<img src="{$baseUrl}public/images/icon4.png" />
						<span>Centri deluxe </span>
					</div>
					<div>
					</div>
				</div>
    <div class="clear"></div>

</div>


{literal}
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  var map;
  var myOptions;
  var markers=[];
  var latlng = new google.maps.LatLng(45.476985,9.18663);
  function initialize() {
      myOptions = {
      zoom: 4,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
  
initialize();
</script>
{/literal}


{foreach item="value" key="key" from=$rs} 
{literal}
<script>
    
    var address={/literal}"{$value.info_google_address}"{literal};
    var image={/literal}"{$baseUrl}public/images/icon{$value.info_class}.png"{literal};
    address=address.split(",");
    var x=address[0];
    var y=address[1];
    var point= new google.maps.LatLng(x,y);
    var marker = new google.maps.Marker({
        position: point, 
        map: map, 
        icon:image,
        title:{/literal}"{$value.info_name}"{literal}
    });

    google.maps.event.addListener(marker, 'click', function(event) {

        window.location='info/single?id={/literal}{$value.info_id}{literal}';


    });
    markers.push(marker);
</script>
{/literal}
{/foreach}
{literal}
<script>
var latlngbounds = new google.maps.LatLngBounds();
  for (i in markers) {
        markers[i].setMap(map);
        latlngbounds.extend(markers[i].getPosition());
}
map.fitBounds(latlngbounds); 

function showWhere(address,type,id,name){
    address=address.split(",");
    var x=address[0];
    var y=address[1];
    var image={/literal}"{$baseUrl}public/images/icon"+type+".png"{literal};
    if (markers) {
        for (i in markers) {
            markers[i].setMap(null);
        }
        markers.length = 0;
    }
    var pointNew= new google.maps.LatLng(x,y);
    var markerNew= new google.maps.Marker({
        position: pointNew, 
        map: map, 
        icon:image,
        title:name
    });
    google.maps.event.addListener(markerNew, 'click', function(event) {

        window.location='info/single?id='+id;


    });
    markers.push(markerNew);
    var latlngbounds = new google.maps.LatLngBounds();
    for (i in markers) {
        markers[i].setMap(map);
        latlngbounds.extend(markers[i].getPosition());
    }
    map.fitBounds(latlngbounds); 
    map.setZoom(15);
    
}

</script>
{/literal}
</div>
{include file = 'f-footer.tpl'}
